//
//  ViewController.m
//  PhotoFrame
//
//  Created by ZhangJitao on 2018/10/16.
//  Copyright © 2018年 Piter Zhang. All rights reserved.
//

#import "ViewController.h"
#import "DZImageFrameController.h"
#import "UIView+Extension.h"

@interface ViewController ()

@property (nonatomic, strong) UIImageView *frameImageView;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view addSubview:self.frameImageView];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    
    DZImageFrameController *imgframeVc = [[DZImageFrameController alloc] init];
    imgframeVc.image = [UIImage imageNamed:@"37.png"];
    __weak typeof(self) weakSelf = self;
    imgframeVc.imageFrameCompleteBlock = ^(UIImage * _Nonnull frameImage) {
        weakSelf.frameImageView.image = frameImage;
    };
    [self showViewController:imgframeVc sender:nil];
}

- (UIImageView *)frameImageView {
    if (!_frameImageView) {
        _frameImageView  = [[UIImageView alloc] initWithFrame:CGRectMake(30, 90, [UIScreen mainScreen].bounds.size.width - 60, [UIScreen mainScreen].bounds.size.height - 120)];
    }
    return _frameImageView;
}


@end
